<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Worklinkenter extends Model
{
    protected $table = 'work_link_enter';
    protected $primaryKey = 'id';

    public static function insertWorkLinkEnter($open_kfid,$external_userid,$scene,$kfid,$record_id,$created_at,$back_platfrom)
    {
        return self::insert(["open_kfid"=>$open_kfid,"external_userid"=>$external_userid,"scene"=>$scene,"kfid"=>$kfid,"record_id"=>$record_id,"created_at"=>$created_at,"back_platfrom"=>$back_platfrom]);
    }

    public static function getWorkLinkEnter($external_userid)
    {
        return self::where("external_userid",$external_userid)->orderBy("id","DESC")->first();
    }
}